﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PMS.XCMG.Util;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace PMS.XCMG.Entity
{
    /// <summary>
    /// 角色
    /// </summary>
    public partial class Sys_Role : BusEntity
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
    }

    public partial class Sys_Role : BusEntity
    {

    }

    /// <summary>
    /// 实体配置
    /// OnModelCreating
    /// </summary>
    public class Sys_RoleTypeConfig : BusEntityTypeConfig<Sys_Role>, IEntityTypeConfiguration<Sys_Role>
    {
        public override void Configure(EntityTypeBuilder<Sys_Role> builder)
        {
            base.Configure(builder);

            #region 主外键关系

            #endregion

            #region 字段属性:最大长度,是否必需,默认值
            builder.Property(p => p.Name).HasMaxLength(EntityDefinition.DefMiddleColLen).IsRequired();
            #endregion

            #region 备注
            builder.HasComment("角色");
            builder.Property(p => p.Name).HasComment("角色名称");
            #endregion

            #region 种子数据
            builder.HasData(
                new Sys_Role { Id = "1", Name = "系统管理员", CreateUserId = "1", ModifyUserId = "1" },
                new Sys_Role { Id = "2", Name = "工段长", CreateUserId = "1", ModifyUserId = "1" },
                new Sys_Role { Id = "3", Name = "工艺员", CreateUserId = "1", ModifyUserId = "1" },
                new Sys_Role { Id = "4", Name = "班组长", CreateUserId = "1", ModifyUserId = "1" },
                new Sys_Role { Id = "5", Name = "操作员", CreateUserId = "1", ModifyUserId = "1" }
            );
            #endregion
        }
    }
}
